package cc.mxtt.mvc.service.impl;

import com.jfinal.plugin.activerecord.Page;

import cc.mxtt.mvc.model.Device;
import cc.mxtt.mvc.model.Project;
import cc.mxtt.mvc.service.ProjectService;

public class ProjectServiceImpl implements ProjectService {

	@Override
	public Page<Project> getDataGrid(int pageNumber, int pageSize,
			String username) {
		//id=  name=ss  address=ss  jiandu=ss  jiance=ss   person=sss  time=2016-03-11  jianshe=ss jianli sheji=ss  kancha=ss  jizhuang=ss  weituo=ss
		String select = "select id,name,address,jiandu,jiance,person,time,jianshe,jianli,sheji,kancha,jizhuang,weituo";
		String formwhere = "from sys_proj";
		formwhere = formwhere + " order by id asc";
		
		
		
		return Project.dao.paginate(pageNumber, pageSize, select, formwhere);
	}

	@Override
	public Page<Project> getDataGrid(int pageNumber, int pageSize,
			String username, Long deptId) {
		String select = "select id,name,address,jiandu,jiance,person,time,jianshe,jianli,sheji,kancha,jizhuang,weituo";
		String formwhere = "from sys_proj where parent_id = "+deptId;
		formwhere = formwhere + " order by id asc";
		System.out.println("formwhere:"+formwhere);
		
		return Project.dao.paginate(pageNumber, pageSize, select, formwhere);
	}

}
